package com.maben.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * 异步调用业务类
 */
@Component
@Slf4j(topic = "m.AsyncService")
public class AsyncServiceImpl implements AsyncService {
    @Async("myAsyncExecutor")
    public void asyncFunction(){
        log.info("执行异步方法--start");
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("执行异步方法--end");
    }
}
